<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		姓名：<input type="text" id="username" onchange="fun1()">
		<hr>
		文本框的值被修改为：<span id="content"></span>
		<script type="text/javascript">
			function fun1(){
				let ele= document.getElementById("username").value;
				let content=document.getElementById("content");
				content.innerHTML=ele;
				console.log(ele);
			}
			document.body.oncopy=function(){
				console.error("网页不允许复制");
				event.preventDefault();
				
			}
			//方法三,添加事件监听
			 let ele=document.getElementById("username");
			 ele.addEventListener("paste",function(){
				 console.error("输入框不允许粘贴");
				event.preventDefault();
			 });
		</script>
	</body>
</html>
